<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ include file="/page/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<%@ include file="/adapter/adapter-bootstrap.jsp" %>
<script type="text/javascript">
function  onLoad(){
	if(parseInt("${result}")>0){
		alert("保存成功");
	}else if(parseInt("${result}")<0){
		alert("保存失败");
	}
	
}

function  goBack(){
	window.history.back(-1);
}

function  checkNum(){
	var num = document.getElementById('comm_timeout').value;
	  if(num)
	  {
	   if( !isNaN(num))
	   {
	    return true;
	   }
	   else
	   {
	    alert('通讯超时时长为数字类型！');
	    comm.comm_timeout.select();
	    return false;
	   }
     }
}

function save(){
	var str_data=$("#comm input").map(function(){
		   return ($(this).attr("name")+'='+$(this).val());
		 }).get().join("&") ;
    $.ajax({
        url:"${ctx}/appFrameComm/updateAppFrameComm",
        type: "POST",      
        dataType:"json",
        data: str_data,
        async: false,
        success: function(data) {
        	if(data.flag>0){
	            alert("保存成功！");	
	            window.location.reload();
        	}
/* 	          $.each(data, function(index, element) {
             window.location.reload();
          }); */
        },
        error: function() {
          alert("error");
        }
      });
	
}
</script>
</head>
<body  onload="onLoad()">
<div class="panel panel-default">
   <div class="panel-heading">
      <h3 class="panel-title">
          App通讯设置信息
      </h3>
   </div>
   <div class="panel-body">
<form class="form-horizontal" role="form"  id="comm"  action="${ctx}/appFrameComm/updateAppFrameComm"  method="post">
      <div class="form-group">
		<label for="APP_ID" class="col-xs-2 control-label">应用标识</label>
		<div class="col-xs-4">
		<input type="text" class="form-control" id="APP_ID" placeholder="APP_ID"  value="${appFrameComm.appId}"  name="appId"  readonly="readonly" >
	    </div>
	    <label for="app_comm_url" class="col-xs-2 control-label">通讯前置服务地址</label>
		<div class="col-xs-4">
		<input type="text" class="form-control" id="app_comm_url"  value="${appFrameComm.appCommUrl}"  name="appCommUrl"   placeholder="app_comm_url">
	    </div>
	  </div>   
	  <div class="form-group">
		<label for="comm_timeout" class="col-xs-2 control-label">通讯超时时长（秒）</label>
		<div class="col-xs-10">
		<input type="text" class="form-control" id="comm_timeout"  value="${appFrameComm.commTimeout}"  name="commTimeout" onblur="checkNum()"  placeholder="comm_timeout">
	    </div>
	  </div>
	  <div class="form-group">
         <div class="col-xs-offset-2 col-xs-10">
         <button type="button" class="btn btn-default"  onclick="save();">保存</button>
         <button type="button" class="btn btn-default"  onclick="goBack();">返回</button>
         </div>
      </div>
</form>
   </div>
</div>
<%@ include file="/page/foot.html" %>
